package Stream.book;

import Stream.book.Book;

import java.util.Arrays;
import java.util.List;
import static java.util.stream.Collectors.toList;

public class TestBookWithStream {
    public static void main(String[] args) {
        List<Book> library = Arrays.asList(
                new Book("夜的命名术", 888),
                new Book("追风筝的人", 399),
                new Book("一分钟教你做一道菜", 39),
                new Book("商务沟通", 59),
                new Book("名模三千问", 198),
                new Book("如何变成亿万富翁",66)
        );
        List<String> highprice = library.stream()
                .filter(book -> book.money>100)
                .sorted((b1,b2)->b2.getMoney()-b1.getMoney())
                .map(d->d.toString())
                .collect(toList());
        for(String name:highprice)
            System.out.println(name);
    }
}